// 引入vue
import Vue from "vue";
// 引入VueRouter
import VueRouter from "vue-router";
// 引入路由组件
import Login from "../pages/Login";
import Home from "../pages/Home";
import News from "../pages/Home/News";
import Music from "../pages/Home/Music";

// 3让Vue使用VueRouter这个插件
Vue.use(VueRouter);
// 4创建路由器对象
export default new VueRouter({
  // 在实例化路由对象配置中书写路由表配置
  routes: [
    { path: "/login", component: Login, name: "login" },
    {
      path: "/home",
      component: Home,
      name: "home",
    //   二级路由
      children: [
        { path: "music", component: Music, name: "music" },
        { path: "news", component: News, name: "news" },
      ],
    },
  ],
});
